﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public partial class HairGen
{
    [SerializeField]
    bool _projCondition;
    bool projCondition
    {
        get
        {
            _projCondition = snapToSurf && !editCurve &&
                !UICurve.I.gameObject.activeSelf &&
                !Events.Alt;
            return _projCondition;
        }
    }
    private void SVMouseUp2D(Vector2 pos2d)
    {
        if (projCondition)
        {
            trail.gameObject.SetActive(false);
            GenerateHair();
        }
    }
    private void SVMouseDown2D(Vector2 pos2d)
    {
        if (projCondition)
        {
            pos2dPrev = Vector3.zero;
            pos2dList = new List<Vector2>();
            pos2dList.Add(pos2d);
            pos2dPrev = pos2d;
            trail.Clear();
            trail.gameObject.SetActive(false);
        }
    }
    void SVMouseDownMove2D(Vector2 pos2d)
    {
        if (projCondition)
        {
            trail.gameObject.SetActive(true);
            trail.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition)
                + Camera.main.transform.forward * cameraZoffset;

            if (Vector2.Distance(pos2d, pos2dPrev) > moveDistInterval)
            {
                pos2dList.Add(pos2d);
                pos2dPrev = pos2d;
            }
        }
    }
}
